package tds.model10.version1;

import lombok.Getter;
import lombok.Setter;

/**
 * @Company 杭州先锋电子技术股份有限公司
 * @ClassName ConcretePrototype
 * @Description ConcretePrototype（具体原型类）：它实现在抽象原型类中声明的克隆方法，在克隆方法中返回自己的一个克隆对象。
 * @author tds
 * @Date 2019/4/25 10:45
 * @version 1.0.0
 */
public class ConcretePrototype implements Prototype{

    private String attr;

    public String getAttr() {
        return attr;
    }

    public void setAttr(String attr) {
        this.attr = attr;
    }

    @Override
    public String toString() {
        return "ConcretePrototype{" +
                "attr='" + attr + '\'' +
                '}';
    }

    @Override
    public Prototype clone() {
        ConcretePrototype concretePrototype = new ConcretePrototype();
        concretePrototype.setAttr(this.getAttr());
        return concretePrototype;
    }
}
